﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LF3.Moduls;
using LF3.Repositories;
using System.Data;

namespace LF3.Controllers
{
    public class Lf_Steel_Sample_AnalysisController
    {
        Lf_Steel_Sample_AnalysisRepository rep = new Lf_Steel_Sample_AnalysisRepository();

        //LF
        public IList<Lf_Steel_Sample_Analysis> GetLFSample(string heatid)
        {
            return rep.GetLFSample(heatid);
        }
        //BOF
        public IList<Lf_Steel_Sample_Analysis> GetBofSample(string heatid)
        {
            return rep.GetBofSample(heatid);
        }

        public DataTable GetHeatID()
        {
            return rep.GetHeatID();
        }

        public IList<Lf_Steel_Sample_Analysis> GetLFSampleCondition(string heatid,string start ,string end)
        {
            string condition="";
            if (!string.IsNullOrEmpty(heatid))
                condition += string.Format(@" and heatid = '{0}'",heatid);
            if (!string.IsNullOrEmpty(start))
                condition += string.Format(@" and insert_time >= to_date('{0}','yyyy-mm-dd') ", start);
            if (!string.IsNullOrEmpty(end))
                condition += string.Format(@" and insert_time < to_date('{0}','yyyy-mm-dd') ", end);
            return rep.GetLFSampleCondition(condition);
        }
        
    }
}
